package com.tianyu.service.mqtt.common;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.integration.channel.DirectChannel;
import org.springframework.integration.channel.ExecutorChannel;
import org.springframework.messaging.MessageChannel;

import jakarta.annotation.Resource;
import java.util.concurrent.Executor;

/**
 * @author swyan
 */

@Configuration
public class MqttMessageChannel {


    public static class ChannelName {
        /**
         * 输入通道
         */
        public static final String INBOUND = "inboundChannel";
        public static final String INBOUND_ROUTE = "inboundRouteChannel";
        public static final String INBOUND_UAV_STATE = "inboundUavStateChannel";
        public static final String INBOUND_HANGAR_UAV_STATE = "inboundHangarUavStateChannel";
        public static final String INBOUND_UAV_STATUS = "inboundUavStatusChannel";
        public static final String INBOUND_SIGNAL = "inboundSignalChannel";
        public static final String INBOUND_HANGAR_STATE = "inboundHangarStateChannel";
        public static final String INBOUND_COMPANY_MESSAGE = "inboundCompanyMessageChannel";
        public static final String INBOUND_INSTRUCT_RES = "inboundInstructResChannel";

        /**
         * 输出通道
         */
        public static final String OUTBOUND = "outboundChannel";

        /**
         * 输出通道
         */
        public static final String OUTBOUND_THIRD01 = "outboundThird01Channel";

        /**
         * 默认通道
         */
        public static final String DEFAULT = "defaultChannel";
    }

    @Resource
    private Executor mqttThreadPool;

    @Bean
    public MessageChannel inboundChannel() {
        return new ExecutorChannel(mqttThreadPool);
    }

    @Bean
    public MessageChannel inboundRouteChannel() {
        return new ExecutorChannel(mqttThreadPool);
    }

    @Bean
    public MessageChannel inboundEventsChannel() {
        return new DirectChannel();
    }

    @Bean
    public MessageChannel inboundUavStateChannel() {
        return new DirectChannel();
    }


    @Bean
    public MessageChannel inboundHangarUavStateChannel() {
        return new DirectChannel();
    }

    @Bean
    public MessageChannel inboundUavStatusChannel() {
        return new DirectChannel();
    }

    @Bean
    public MessageChannel inboundSignalChannel() {
        return new DirectChannel();
    }

    @Bean
    public MessageChannel inboundHangarStateChannel() {
        return new DirectChannel();
    }

    @Bean
    public MessageChannel inboundCompanyMessageChannel() {
        return new DirectChannel();
    }

    @Bean
    public MessageChannel inboundInstructResChannel() {
        return new DirectChannel();
    }

    @Bean
    public MessageChannel outboundChannel() {
        return new DirectChannel();
    }

    @Bean
    public MessageChannel outboundThird01Channel() {
        return new DirectChannel();
    }


    @Bean
    public MessageChannel defaultChannel() {
        return new DirectChannel();
    }

}
